import {
	listequimentType,
	listoperationsystemType,
  listequipment
} from '@/api/equipment'
const store = {
	state: {
		equipmentOptions: {},
		operationsystemTypeOptions: {},
    equipmentInfoOPtions: {},
	},
	getters: {
		getEquipmentOptions(state) {
			return state.equipmentOptions
		},
		getoperationsystemTypeOptions(state) {
			return state.operationsystemTypeOptions
		},
    getEquipmentInfoOPtions(state) {
      return state.equipmentInfoOPtions
    },
	},
	mutations: {
		UPDATE_EQUIPMENTTYPE_OPTIONS(state, data) {
			state.equipmentOptions = data
		},
		UPDATE_OPERATISON_SYSTEM_TYPE_OPTIONS(state, data) {
			state.operationsystemTypeOptions = data
		},
    UPDATE_EQUIPMENTINFO_OPTIONS(state,data) {
      state.equipmentInfoOPtions = data
    },
	},
	actions: {
		setEquipmentOptions({
			commit
		}) {
// 			listequimentType()
// 				.then((response => {
// 					console.log("response: " + response);
// 					commit('UPDATE_EQUIPMENTTYPE_OPTIONS', response)
// 				}))
			let data = listequimentType()
			commit('UPDATE_EQUIPMENTTYPE_OPTIONS', data)
		},
		
		setoperationsystemTypeOptions({
					commit
				}) {
		// 			listequimentType()
		// 				.then((response => {
		// 					console.log("response: " + response);
		// 					commit('UPDATE_EQUIPMENTTYPE_OPTIONS', response)
		// 				}))
					let data = listoperationsystemType()
					commit('UPDATE_OPERATISON_SYSTEM_TYPE_OPTIONS', data)
				},
    setEquipmentInfoOptions({
      commit
    }){
      listequipment().then(response => {
        commit('UPDATE_EQUIPMENTINFO_OPTIONS', response)
      })
    },
	}
}

export default store
